#override("title")
SpringWind - 场地列表
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
<link href="#springUrl('/static/css/plugins/bootstrap-fileinput/fileinput.min.css')" rel="stylesheet">
<link href="#springUrl('/static/css/less/style.css')" rel="stylesheet">
<style type="text/css">
    .btn-next{
        width: 4%;
        margin: 1%;
    }
    .d1{
        padding-right: 50%;
    }
    .d2{
        padding-right: 20%;
    }
    .c1{
        display: inline-block;
        width: 18px;height: 18px;
        border: 1px solid #ccc;
        cursor: pointer;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        vertical-align: middle;
    }
    .c1:checked+b{
        　　background: #f00;border-color: #f00;
    }

    .black_overlay{
        display: none;
        position: absolute;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: black;
        z-index:1001;
        -moz-opacity: 0.8;
        opacity:.80;
        filter: alpha(opacity=88);
    }
    .white_content {
        background-color: #f3f3f4;
        display: none;
        position: absolute;
        top: 25%;
        left: 25%;
        width: 65%;
        height: 70%;
        padding: 0%;
        z-index:1002;
        overflow: auto;
    }
    .content_left{
        height: 80%;
        width: 60%;
        margin-left:5%;
        float: left;
        display: inline-block
    }
    .content_left_top{
        height: 10%;
        width: 96%;
        float: left;
    }
    .content_left_bottom{
        height: 87%;
        width: 100%;
        float: left;
    }
    .content_right{
        height: 80%;
        width: 30%;
        margin-right:2%;
        float: right;
        display: inline-block
    }
    .tableThreat{
        table-layout:fixed;
        empty-cells:show;
        border-collapse: collapse;
        margin:0 auto;
        /*border:1px solid #cad9ea;*/
        color:#666;
        display: inline-block;
    }
    .tableThreat th {
        font: bold 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        color: #4f6b72;
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        border-top: 1px solid #C1DAD7;
        letter-spacing: 2px;
        text-transform: uppercase;
        text-align: center;
        padding: 6px 6px 6px 12px;
        background: #CAE8EA no-repeat;
    }
    .tableThreat td,.table th{
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        background: #fff;
        font-size:14px;
        padding: 6px 6px 6px 12px;
        color: #4f6b72;
    }
    .tableThreat tr.alter{
        background-color:#f5fafe;
    }
    .tableBottom th{
        color: white;
        background-color: white;
        border: none;
    }


    .tableThreat2{
        table-layout:fixed;
        empty-cells:show;
        border-collapse: collapse;
        margin:0 auto;
        border:1px solid #cad9ea;
        color:#666;
    }
    .tableThreat2 th {
        font: bold 12px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        color: #4f6b72;
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        border-top: 1px solid #C1DAD7;
        letter-spacing: 2px;
        text-transform: uppercase;
        text-align: left;
        padding: 6px 6px 6px 12px;
        background: #CAE8EA no-repeat;
    }
    .tableThreat2 td,.table th{
        border-right: 1px solid #C1DAD7;
        border-bottom: 1px solid #C1DAD7;
        background: #fff;
        font-size:14px;
        padding: 6px 6px 6px 12px;
        color: #4f6b72;
    }
    .tableThreat2 tr.alter{
        background-color:#f5fafe;
    }
</style>
#end
#override("breadcrumb")
<li><a>评分系统</a></li><li class="active"><strong>场地列表</strong></li><li class="active"><strong id="province">$!{province}</strong></li><li class="active"><strong id="city">$!{city}</strong></li>
<div class="container">
    <ul class="nav nav-pills nav-justified step step-arrow">
        <li>
            <a href="#springUrl('/examine/source')/${siteId}/0">污染物</a>
        </li>
        <li>
            <a href="#springUrl('/examine/ground')/${siteId}/0">地下水</a>
        </li>
        <li>
            <a href="#springUrl('/examine/surfaceIndex')/${siteId}/0/0/0">地表水</a>
        </li>
        <li>
            <a href="#springUrl('/examine/soil')/${siteId}">土壤</a>
        </li>
        <li>
            <a href="#springUrl('/examine/air')/${siteId}">空气</a>
        </li>
    </ul>
</div>


#end
#override("content")
<div class="ibox-content" >
   <form id="myForm" class="form-horizontal" autocomplete="off" data-validator-option="{theme:'default'}">
       <input type="hidden" id="siteId" name="siteId" value="$!{user.siteId}">
       <div class="form-group"><label class="col-sm-2 control-label">来源编码</label>
           <div class="col-sm-10 d1">
               <input type="text" class="form-control" name="source_site_Id"  value="$!{source.id}" readonly>
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">来源名称</label>
      		<div class="col-sm-10 d1">
			<input type="text" class="form-control" value="$!{source.source_name}" name="source_name"  placeholder="请输入来源名称" data-rule="来源名称:required;source_name" readonly>
      		</div>
       </div>
        <div class="form-group"><label class="col-sm-2 control-label">来源类型</label>
            <div class="col-sm-10 d1">
            <!--<input id="source_type" type="hidden"  class="form-control" name="source_type"  placeholder="请选择来源类型" >-->
                <select name="source_type"  class="form-control"  id="datalist" class="sel-1">
                    <!--<option value="1">单独选择</option>-->
                    <option value="2">废物填埋</option>
                    <option value="3">地表渗坑(未燃烧/回填)</option>
                    <option value="4">地表渗坑(燃烧/回填)</option>
                    <option value="5">桶</option>
                    <option value="6">储罐及非桶容器</option>
                    <option value="7">污染土壤</option>
                    <option value="8">堆</option>
                    <option value="9">土壤威胁</option>
                    <option value="10">其他</option>
                </select>
            </div>
        </div>
       <div class="form-group"><label class="col-sm-2 control-label">主要危害要素质量</label>
           <div class="col-sm-10 d2">
               <input type="text" class="form-control" value="$!{source.quantity1}" name="quantityA"  style="width: 315px;display: inline" readonly>&nbsp;&nbsp;<label style="width: 25px">lbs</label>&nbsp;&nbsp;&nbsp;
               <!--<input type="radio" class="" name="is_ade_dete"  value="is_ade_dete1">检查层A是否充分确定-->
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">主要废弃物质量</label>
           <div class="col-sm-10 d2">
               <input type="text" class="form-control" value="$!{source.quantity2}" name="quantityB"  style="width: 315px;display: inline" readonly>&nbsp;&nbsp;<label style="width: 25px">lbs</label>&nbsp;&nbsp;&nbsp;
               <!--<input type="radio" class="" name="is_ade_dete"  value="is_ade_dete2">检查层B是否充分确定-->
                <br /> <br />
               <!-- </div><br />
           <div class="col-sm-11 d2">-->
               <input type="text" class="form-control" value="$!{source.quantity3}" name="quantityC"  style="width: 315px;display: inline" readonly>&nbsp;&nbsp;<label style="width: 25px">yd3</label>&nbsp;&nbsp;&nbsp;
               <!--<input type="radio" class="" name="is_ade_dete"  value="is_ade_dete3">检查层C是否充分确定-->
               <br /> <br />
               <!-- </div><br />
           <div class="col-sm-11 d2">-->
               <input type="text" class="form-control" value="$!{source.quantity4}" name="quantityD"  placeholder="请输入主要废弃物质量" style="width: 315px;display: inline" readonly>&nbsp;&nbsp;<label style="width: 25px">ft2</label>&nbsp;&nbsp;&nbsp;
               <!--<input type="radio" class="" name="is_ade_dete"  value="is_ade_dete4">检查层D是否充分确定-->
           </div>
       </div>
      <!-- <div class="form-group"><label class="col-sm-2 control-label">源危险废物量(HWQ)</label>
           <div class="col-sm-10">
               <input type="button" class="btn btn-info" name=""  value="计算" >
           </div>
       </div>-->
      <!-- <div class="form-group"><label class="col-sm-2  control-label">如果你为土壤暴露(SE)路径评分</label>
           <div class="col-sm-10">
              <input type="checkbox" class="c1"  name="is_soil_exp">
           </div>
       </div>-->
    <!--   <div class="form-group"><label class="col-sm-2 control-label">这个源中的物质能够迁移到下列哪条路径?</label>
           <div class="col-sm-10">
               <input type="checkbox" class="c1" name="is_gw_mig_path" >地下水迁移途径
               <br />
               &lt;!&ndash;</div>
           <div class="col-sm-10">&ndash;&gt;
               <input type="checkbox" class="c1" name="is_sw_mig_path" >地表水迁移途径
               <br />
               &lt;!&ndash;</div>
           <div class="col-sm-10">&ndash;&gt;
               <input type="checkbox" class="c1" name="air_mig_path" >空气迁移途径
           </div>
       </div>-->
       <div class="form-group"><label class="col-sm-2 control-label">哪些物质与这个源相关联:
<!--
           <input type="button" class="btn btn-info" value="添加关联物质" onclick="openThreat('dwThreat','dwFade')">
-->
       </label>

           <div class="col-sm-10 d1">
               <select name="dangerous" id="dangerous"  class="form-control"   class="sel-1" multiple="multiple">

               </select>
           </div>
       </div>
       <div class="hr-line-dashed"></div>

      <!-- <div id="dwThreat" class="white_content">
           <div class="threatTop">
               <a href = "javascript:void(0)" onclick = "closeThreat('dwThreat','dwFade')" >
                   <p style="font-size: 30px;margin-left:95%;display: inline">×</p></a>
           </div>
           <div class="content_left" >
               <div class="content_left_top" style="white-space: nowrap;overflow-y: hidden;overflow-x: hidden;" id="scrollHead">
                   <table class="tableThreat" >
                       <thead id="tableHead"></thead>
                   </table>
               </div>
               <div class="content_left_bottom" style="white-space: nowrap;overflow-y: scroll;" id="scrollDiv">
                   <table class="tableThreat" style="table-layout: fixed">
                       <tbody id="tableIndex"></tbody>
                   </table>
               </div>
           </div>
           <div class="content_right">
               <label >与污染源源相关的物质</label>
               <select name="dangerousSelect" id="dangerousSelect" class="form-control" style="height: 300px"   class="sel-1" multiple="multiple">
            </select>
               <div style="margin-top: 5px">
                   <button  class="btn btn-info" onclick="selectInfo('dangerousSelect');return false" style="width: 80%;margin-left: 5%"  type="button">添加</button>
               </div>
               <br /><br />
              &lt;!&ndash; <label >与该地区相关的物质，但其特殊污染源不能确定</label>
               <select name="dangerousSpeciffic" id="dangerousSpeciffic"  class="form-control"   class="sel-1" multiple="multiple">
               </select>
               <div style="margin-top: 5px">
                   <button class="btn btn-info" onclick="selectInfo('dangerousSpeciffic');return false" style="width: 80%;margin-left: 5%"  type="button">添加</button>
               </div>&ndash;&gt;
               <button class="btn btn-info" onclick="saveDangerous();closeThreat('dwThreat','dwFade');return false" style="width: 80%;margin-top: 25px;margin-left: 5%"  type="button">保存并退出</button>
               <button class="btn btn-danger" onclick="delSelect();return false" style="width: 80%;margin-top: 10px;margin-left: 5%"  type="button">从列表中删除</button>

           </div>
       </div>-->
     <!--  <div id="dwFade" class="black_overlay"></div>-->


        <div class="form-group">
            <div class="text-center">
                <a class="btn btn-primary btn-next"  href="javascript:history.go(-1)">  <  </a>
              <!--  <button class="btn btn-primary" type="submit">保存</button>-->
                <a class="btn btn-primary btn-next" href="#springUrl('/examine/ground/')${siteId}/0" >  >  </a>
            </div>
        </div>
    </form>


    <div class="row ibox-content" style="margin:3%;padding: 4% 2%">
        <div class="row">
            <div class="col-sm-12">
                <table width="100%" class="tableThreat2" id="tableList">
                </table>
            </div>
        </div>
    </div>



</div>
#end
#override("js")
<script src="#springUrl('/static/js/jquery-2.1.1.js')"></script>
<script src="#springUrl('/static/js/lib/less.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/lib/jquery.min.js')"></script>
<script src="#springUrl('/static/js/lib/lib.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>
<script type="text/javascript">
   // var source = '${source}';
    var siteId = '${siteId}';
  //  var dangerousList = JSON.parse('${dangerousList}');
  //  var siteSource = JSON.parse('${siteSource}');
    var dangerousSelect = JSON.parse('${dangerousSelect}');
    var selectDangerous = "";
   var dType = '${source.source_type}';
   var dataoptions =$('#datalist option');

       $(function () {
           bsStep(1);
        $('#siteId').val(siteId);
       // tableCreate();
       // sourceCreate();
        dangerousSelectCreate();
           typeSelect(dType);
        $('#scrollDiv').scroll(function () {
            var t = this.scrollLeft;
            $('#scrollHead').scrollLeft(t);
        });
      //  onclickTd();
    });

   function typeSelect(type) {
       for(i = 0;i<dataoptions.length;i++){
           if(dataoptions[i].value==type){
              dataoptions[i].selected = 'checked';
               $('#datalist').attr('readonly','readonly');
           }
       }
   }


    function dangerousSelectCreate() {
        for(i=0;i<dangerousSelect.length;i++){
            $('#dangerous').append("<option value='"+dangerousSelect[i].dangerous_id+"'>"+dangerousSelect[i].chnname+"</option>");
         //   $('#dangerousSelect').append("<option value='"+dangerousSelect[i].dangerous_id+"'>"+dangerousSelect[i].chnname+"</option>");
        }
    }

/*function onclickTd() {
    var indexTr = $('#tableIndex tr');
    var indexTd = $('#tableIndex tr td');
    indexTr.click(function () {
        indexTd.css('background-color','white');
        $(this).children('td').css('background-color','#CAE8EA');
        selectDangerous= this.id;
    });
}*/

/*$("#myForm").validator({
    valid: function(form){
        var me = this;
        // 提交表单之前，hold住表单，防止重复提交
        me.holdSubmit();

        var dangerous = $('#dangerous option');
        for(i=0;i<dangerous.length;i++){
            dangerous[i].selected = 'checked';
        }

        $.ajax({
        	url: "#springUrl('/siteSource/save')",
            data: $(form).serialize(),
            type: "POST",
            success: function(data){
                parent.layer.alert("保存成功",function(){
                    parent.layer.closeAll();
                    window.parent.location.reload();
                });

            /!*	var d = JSON.parse(data);
                if(d.success && d.data){

                	//当你在iframe页面关闭自身时
                	//var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                	//parent.layer.close(index); //再执行关闭   
                } else {
                	//失败，提交表单成功后，释放hold，如果不释放hold，就变成了只能提交一次的表单
                    me.holdSubmit(false);
                }*!/
            }
        });
    }
});*/

    //编辑功能
    /*function editSource(id) {
        window.parent.location.href = "#springUrl('/siteSource/add/"+siteId+"/"+id+"')";
    }*/

    //删除功能
   /* function delSource(id) {
      //  alert(id);

        $.ajax({
            type: 'POST',
            url: "#springUrl('/siteSource/delSource')",
            data: $.param({'id':id}),
            success: function (result) {
                parent.layer.alert("删除成功",function(){
                    parent.layer.closeAll();
                    window.parent.location.reload();
                });
            },
            dataType: 'json'
        });
    }*/

/*function  openThreat(id,fade) {
    var light = document.getElementById(id);
    var top =  document.documentElement.scrollTop;
    light.style.display='block';
    light.style.top = '3%';
    /!*light.style.top = (document.documentElement.clientHeight-light.height)/2+top + 'px';*!/
}

function closeThreat(id,fade) {
    var light = document.getElementById(id);
    light.style.display='none';

}*/
/*function sourceCreate() {
    var tdd = "<tr><th >序号</th><th >名称</th><th >类型</th><th>危险废物量</th><th >操作</th></tr>";
    for(i=0;i<siteSource.length;i++){
        tdd+="<tr id='site"+siteSource[i].id+"'><td>"+(i+1)+"</td><td>"+siteSource[i].source_name+"</td><td>"+siteSource[i].source_type+"</td><td>"+siteSource[i].hWQ+"</td>" +
            "<td><button class='btn btn-warning'  type='button' id='editSource"+i+"' onclick='editSource("+siteSource[i].id+");return false'>编辑</button>"+
            "<button class='btn btn-danger'  type='button' id='delSource"+i+"' onclick='delSource("+siteSource[i].id+");return false'>删除</button></td></tr>";
    }
    document.getElementById('tableList').innerHTML = tdd;
}*/

/*function tableCreate() {
    var tdd="<tr><th rowspan='2'>CAS编号</th><th rowspan='2'>化学名称</th><th rowspan='2'>毒性</th><th colspan='2'>生态毒性</th><th colspan='4'>地下水移动性</th><th colspan='2'>气体</th><th colspan='2'>持续性</th><th colspan='4'>生物累积</th></tr>" +
            "<tr><th>淡水</th><th>盐水</th><th>液体/喀斯特</th><th>液体/非喀斯特</th><th>非液体/喀斯特</th><th>非液体/非喀斯特</th><th>移动性</th><th>流动性</th><th>湖泊</th><th>河流</th><th>淡水/环境</th><th>盐水/环境</th><th>淡水/食物链</th><th>盐水/食物链</th></tr>";
    var tdd2 = "";
    for(i=0;i<dangerousList.length;i++){
        tdd2+="<tr  id='"+i+"'><td>"+dangerousList[i].casnum+"</td><td>"+dangerousList[i].chnname+"</td><td>"+dangerousList[i].tox+"</td><td>"+dangerousList[i].tox_fen+"</td><td>"+dangerousList[i].tox_sen+"</td><td>"+dangerousList[i].moblk+"</td><td>"+dangerousList[i].moblnk+"</td>" +
            "<td>"+dangerousList[i].mobnlk+"</td><td>"+dangerousList[i].mobnlnk+"</td><td>"+dangerousList[i].gasmobt+"</td><td>"+dangerousList[i].gasmig+"</td><td>"+dangerousList[i].pers_lak+"</td><td>"+dangerousList[i].pers_riv+"</td><td>"+dangerousList[i].bcfef+"</td>" +
            "<td>"+dangerousList[i].bcfes+"</td><td>"+dangerousList[i].bcff+"</td><td>"+dangerousList[i].bcfs+"</td></tr>";
       tdd+="<tr><td>"+dangerousList[i].casnum+"</td><td>"+dangerousList[i].chnname+"</td><td>"+dangerousList[i].tox+"</td><td>"+dangerousList[i].tox_fen+"</td><td>"+dangerousList[i].tox_sen+"</td><td>"+dangerousList[i].moblk+"</td><td>"+dangerousList[i].moblnk+"</td>" +
            "<td>"+dangerousList[i].mobnlk+"</td><td>"+dangerousList[i].mobnlnk+"</td><td>"+dangerousList[i].gasmobt+"</td><td>"+dangerousList[i].gasmig+"</td><td>"+dangerousList[i].pers_lak+"</td><td>"+dangerousList[i].pers_riv+"</td><td>"+dangerousList[i].bcfef+"</td>" +
            "<td>"+dangerousList[i].bcfes+"</td><td>"+dangerousList[i].bcff+"</td><td>"+dangerousList[i].bcfs+"</td></tr>";
    }
/!*   tdd2+="<tr ><td rowspan='2'>CAS编号</td><td rowspan='2'>化学名称</td><td rowspan='2'>毒性</td><td colspan='2'>生态毒性</td><td colspan='4'>地下水移动性</td><td colspan='2'>气体</td><td colspan='2'>持续性</td><td colspan='4'>生物累积</td></tr>" +
        "<tr><td>淡水</td><td>盐水</td><td>液体/喀斯特</td><td>液体/非喀斯特</td><td>非液体/喀斯特</td><td>非液体/非喀斯特</td><td>移动性</td><td>流动性</td><td>湖泊</td><td>河流</td><td>淡水/环境</td><td>盐水/环境</td><td>淡水/食物链</td><td>盐水/食物链</td></tr>";*!/
     tdd2+="<tr class='tableBottom'><th rowspan='2'>CAS编号</th><th rowspan='2'>化学名称</th><th rowspan='2'>毒性</th><th colspan='2'>生态毒性</th><th colspan='4'>地下水移动性</th><th colspan='2'>气体</th><th colspan='2'>持续性</th><th colspan='4'>生物累积</th></tr>" +
        "<tr class='tableBottom'><th>淡水</th><th>盐水</th><th>液体/喀斯特</th><th>液体/非喀斯特</th><th>非液体/喀斯特</th><th>非液体/非喀斯特</th><th>移动性</th><th>流动性</th><th>湖泊</th><th>河流</th><th>淡水/环境</th><th>盐水/环境</th><th>淡水/食物链</th><th>盐水/食物链</th></tr>";
    document.getElementById('tableHead').innerHTML = tdd;
    document.getElementById('tableIndex').innerHTML = tdd2;
}*/

/*function selectInfo(id) {
    id = '#'+id;
    var opi = id+' option';
    if(selectDangerous==""){
        return;
    }
    var op = "";
    if(id=='#dangerousSpeciffic'){
        op = "<option onclick='quitSelect()'  value='"+dangerousList[selectDangerous].id+"'>"+dangerousList[selectDangerous].chnname+"</option>";
    }else if(id=='#dangerousSelect'){
        op = "<option onclick='quitSpeciffic()'  value='"+dangerousList[selectDangerous].id+"'>"+dangerousList[selectDangerous].chnname+"</option>";
    }
    var hopList = $(opi);
    for(var i =0;i<hopList.length;i++){
        //alert(hopList[i].value);
        if(hopList[i].value == dangerousList[selectDangerous].chnname){
            return;
        }
    }
    $(id).append(op);
}*/

/*function delSelect() {
    var dop = $('#dangerousSelect option');
    var dopc = $('#dangerousSpeciffic option');
   for(var t=0;t<dop.length;t++){
        if(dop[t].selected == true){
            dop[t].remove();
        }
    }
    for(var d=0;d<dopc.length;d++){
        if(dopc[d].selected == true){
            dopc[d].remove();
        }
    }
}

function quitSelect() {
    var dop = $('#dangerousSelect option');
    for(var t=0;t<dop.length;t++){
        dop[t].selected = false;
    }
}

    function quitSpeciffic() {
        var dop = $('#dangerousSpeciffic option');
        for(var t=0;t<dop.length;t++){
            dop[t].selected = false;
        }
    }

    function saveDangerous() {
        var opList = $('#dangerousSelect option');
        $('#dangerous option').remove();
        for(var i = 0;i<opList.length;i++){
            $('#dangerous').append("<option value='"+opList[i].value+"'>"+opList[i].innerText+"</option>");
        }
    }*/

</script>
#end
#extends("/common/framework.html")
